<%@ page language="java" contentType="text/html; charset=UTF-8"
         pageEncoding="UTF-8" %>
<%@include file="/static/common/taglib.jsp" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html>
<head>
    <title>新增MAC地址</title>
    <%@include file="../../public/commonCss.jsp" %>
    <%@include file="../../public/commonJs.jsp" %>
</head>
<body>
<div id="wrapper">
    <div class="boxmain whiteBox lrbox">
        <div class="lrboxmain borderL" style="margin-left:0%">
            <div class="from-header borderB contentbox">
                <div>
                    <span class="font14"> 所属分类:</span><a id="category"><span class=" fontOrange2">权限新增</span></a>
                </div>
            </div>
            <div class="from-body withheader contentbox">
                <div class="layui-field-box">
                    <table class="layui-table" style="margin-top:100px;width: 400px;margin-left:29%">
                        <thead>
                        <tr>
                            <th>序号</th>
                            <th>授权码</th>
                        </tr>
                        </thead>
                        <tbody>
                        <c:forEach items="${macs}" var="mac" varStatus="sta">
                            <tr align="center">
                                <td>${sta.index+1}</td>
                                <td>${mac.macMd5}</td>
                            </tr>
                        </c:forEach>
                        </tbody>
                    </table>
                </div>
                <div class="layui-form layui-form-pane" style="margin-left:30%">
                    <div class="layui-form-item">
                        <div class="layui-inline">
                            <label class="layui-form-label" style="font-size:16px;width:80px">授权码：</label>
                            <div class="layui-input-block">
                                <input type="text" name="macMd5" required lay-verify="required"
                                       placeholder="请输入授权码" class="layui-input"
                                style="width: 278px"/>
                            </div>
                        </div>
                    </div>
                    <div class="layui-form-item">
                        <div class="layui-input-block">
                            <button class="layui-btn" lay-submit lay-filter="formDemo">保存</button>
                        </div>
                    </div>
                </div>

            </div>
        </div>
    </div>
    <!-- whitebox -->
</div>
<script type="text/javascript">
    var form = layui.form();
    //监听提交
    form.on('submit(formDemo)', function (data) {
        //这里执行ajax提交
        $.ajax({
            type: 'post',
            url: '${ctx}/saveMac',
            data: data.field,
            dataType: "json",
            timeout: 10000,
            success: function (data) {
                if (data.code == 0) {
                    window.location.reload();
                }
            }
        });
        return false;
    });
</script>
</body>
</html>